<template>
  <el-dialog
    append-to-body
    :close-on-click-modal="false"
    :before-close="crud.cancelCU"
    :visible="crud.status.cu > 0"
    :title="crud.status.title"
    width="900px"
  >
    <el-form
      label-width="100px"
      size="small"
      ref="form"
      :model="form"
      :rules="rules"
      :inline="true"
    >
      <el-form-item label="事件名称：" prop="contentName">
        <el-input v-model="form.contentName" style="width:200px;"/>
      </el-form-item>
      <el-form-item label="预计完成时间：" label-width="120px"  prop="planTime">
        <el-date-picker
        
          v-model="form.planTime"
          type="datetime"
          size="small"
          class="filter-item charges-date-picker"
          placeholder="预计完成时间"
          value-format="yyyy-MM-dd HH:mm:ss"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="负责人：" prop="responsibleUserName">
        <el-input v-model="form.responsibleUserName" style="width:200px;"/>
      </el-form-item>
      <el-form-item label="事件内容：" prop="content">
        <el-input v-model="form.content" style="width:400px;" type="textarea"  :rows="4" />
      </el-form-item>
      <!-- <el-form-item label="药房" prop="pharmacyId">
        <el-input v-model="form.pharmacyId"/>
      </el-form-item> -->
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="crud.cancelCU">取消</el-button>
      <el-button :loading="crud.procesLoading" type="primary" @click="crud.submitCU">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import CRUD, { form } from '@crud/crud';

const defaultForm = {
  content: null,
  responsibleUserName: null,
  planTime: null,
  contentName: null,
  status:1,
}

export default {
  name: "commissionForm",
  mixins: [ form(defaultForm) ],
  props: {
    pharmacyId: {
      type: String | Number,
      required: true
    }
  },
  data() {
    return {
      rules: {
        contentName: [
          { required: true, message: '请输入待办事项名称', trigger: 'blur' }
        ],
        content: [
          { required: true, message: '请输入待办事项内容', trigger: 'blur' }
        ]
      },
    }
  },
  methods: {
    [CRUD.HOOK.beforeToCU]() {
      this.$store.dispatch("GetInfo").then(res => {
      this.form.createUserId = res.pharmacyId;
    });
      
    }
  }
}
</script>